import { Button, Modal, Form, Input, message } from 'antd';
import { eidtReason, getReason } from '../../../../utils/cbt/sendRequset'
const Edit = (props) => {
    const tailLayout = {
        wrapperCol: {
            offset: 17,
            span: 20,
        },
    };
    const { open, cancleBtn, eidtData, getMsg } = props
    const onFinish = (values) => {
        values.id = eidtData.id
        eidtReason(values).then(res => {
            if (res.code == 200) {
                message.success('编辑成功')
                cancleBtn()
                getMsg()//渲染数据
            }
        })

    };
    const handleCancel = () => {
        cancleBtn();
    };
    return (

        <Modal
            title="退货原因编辑"
            open={open}
            onCancel={handleCancel}
            destroyOnClose='true'
            footer={null}
        >
            <Form
                name="basic"
                labelCol={{
                    flex: '80px',
                }}
                labelAlign="left"
                labelWrap
                wrapperCol={{
                    flex: 1,
                }}
                colon={false}
                initialValues={eidtData}
                onFinish={onFinish}

            >
                <Form.Item
                    label="原因"
                    name="reason"
                    rules={[
                        {
                            required: true,
                        },
                    ]}
                >
                    <Input />
                </Form.Item>

                <Form.Item
                    label="创建时间"
                    name="reason_create_time"

                >
                    <Input disabled />
                </Form.Item>
                <Form.Item {...tailLayout}>
                    <Button htmlType="button" onClick={handleCancel}>
                        取消
                    </Button>
                    <Button type="primary" htmlType="submit" style={{marginLeft:'10px'}}>
                        确认
                    </Button>
                </Form.Item>

            </Form>
        </Modal>

    );
};
export default Edit;